package com.kylinhunter.ch.main;

import java.util.Locale;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.kylinhunter.ch.language.ResourceManager;
import com.kylinhunter.ch.system.CHSystem;

public class Main {
	public static void main(String args[]){
		ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"*Context.xml"});	
		CHMainUI cHMainUI=(CHMainUI) context.getBean("chMainUI");
		CHSystem chSystem=(CHSystem) context.getBean("chSystem");
		cHMainUI.chInit();
		if (chSystem.init()) {
			boolean chinese = chSystem.getChConfig().getConfig().isChinese();
			if (chinese) {
				ResourceManager.getInstance().languageChangedEvent(new Locale("zh", "CN"));

				chinese = true;
			} else {
				ResourceManager.getInstance().languageChangedEvent(new Locale("en", "US"));
				chinese = false;
			}
		}
		
		cHMainUI.setVisible(true);
	}

}
